package com.ys.peony.base;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.ys.peony.app.BaseApplication;
import com.ys.peony.enums.SwipeDirect;
import com.ys.peony.utils.AnimUtils;

/**
 * Created by 59153 on 2017/8/7.
 */

public abstract class BasicFragment<V extends BaseContract.IBaseView, P extends BasePresenter> extends BaseFragment implements BaseContract.IBaseView {

    public P presenter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        presenter = initPresenter();
        if (presenter != null) {
            presenter.relateView(this);
        }
        return super.onCreateView(inflater, container, savedInstanceState);

    }

    protected abstract P initPresenter();

    @Override
    public int getLayoutRes() {
        return 0;
    }

    @Override
    public void initView() {

    }



    @Override
    public void onDestroy() {
        super.onDestroy();
        presenter.detachWindow();
    }
}
